export const formList = [
  {
    label: "中文片名/Film Title（Chinese）",
    val: "",
    field: "film_name",

    require: true,
    type: "input",
    rightMargin: true
  },
  {
    label: "英文片名/Film Title（English）",
    val: "",
    field: "film_name_en",
    require: true,
    type: "input"
  },
  {
    label: "原文片名/Original Film Title",
    val: "",
    field: "original_film_title",

    type: "input",
    rightMargin: true
  },
  {
    label: "片长/Running Time",
    val: "",
    field: "film_time",
    require: true,
    type: "input",
    detailHeight: true
  },
  {
    label: "出品时间",
    val: "",
    field: "original_release_date",
    type: "date",
    require: true
  },
  {
    label: "出品国家/地区",
    val: "",
    field: "origin_area",
    type: "select",
    require: true,
    chooseList: []
  },
  {
    label: "导演/Director",
    val: "",
    field: "director",

    require: true,
    type: "input",
    rightMargin: true
  },
  {
    label: "编剧/Screen Writer",
    val: "",
    field: "screen_writer",

    require: true,
    type: "input"
  },
  {
    label: "2D/3D",
    val: [],
    field: "film_version",

    require: true,
    type: "select",
    rightMargin: true,
    multiple: true,
    detailHeight: true,
    chooseList: [
      { label: "IMAX", value: "1" },
      { label: "4D", value: "2" },
      { label: "3D", value: "3" },
      { label: "2D", value: "4" }
    ]
  },
  {
    label: "影片类型/Cinema Category",
    val: "",
    field: "cinema_category",

    require: true,
    type: "select",
    chooseList: [
      {
        label: "球幕影片",
        value: "1"
      },
      {
        label: "巨幕影片",
        value: "2"
      },
      {
        label: "4D影片",
        value: "3"
      },
      {
        label: "科幻影片",
        value: "4"
      },
      {
        label: "科学家精神影片",
        value: "5"
      },
      {
        label: "其他特效影片",
        value: "6"
      },
      {
        label: "动感影片",
        value: "7"
      },
      {
        label: "飞行影片",
        value: "8"
      },
      {
        label: "映前秀",
        value: "9"
      },
      {
        label: "科普纪录片",
        value: "10"
      }
    ]
  },
  {
    label: "影片可支持放映的影院（可多选）",
    val: [],
    field: "film_cinema_type",
    type: "select",
    require: true,
    multiple: true,
    chooseList: [
      {
        label: "球幕影片",
        value: "1"
      },
      {
        label: "巨幕影片",
        value: "2"
      },
      {
        label: "4D影片",
        value: "3"
      },
      {
        label: "其他特效影片",
        value: "4"
      }
    ]
  },
  {
    label: "影片规格/Film Format（可多选）",
    val: [],
    field: "film_format",
    type: "select",
    require: true,
    multiple: true,
    chooseList: [
      {
        label: "数字",
        value: "1"
      },
      {
        label: "序列帧",
        value: "2"
      },
      {
        label: "视频",
        value: "3"
      },
      {
        label: "其他",
        value: "4"
      }
    ]
  },
  {
    label: "出品公司",
    val: "",
    field: "production_company",
    require: true,
    type: "input",
    width: "100%"
  },
  {
    label: "发行公司",
    val: "",
    field: "release_company",
    require: true,
    type: "input"
  },
  {
    label: "发行公司对该影片的发行期限/Release Period ",
    val: "",
    field: "release_period",
    type: "date",
    detailHeight: true
    // require: true,
  },
  {
    label: "影片中文简介Film Chinese Synopsis",
    val: "",
    field: "film_introduction",
    require: true,
    type: "input",
    width: "100%",
    maxlength: 100,
    inputType: "textarea",
    autosize: { minRows: 3, maxRows: 6 },
    rules: [
      { required: true, message: `请输入影片中文简介(30-100字)`, trigger: ["blur", "change"] },
      {
        validator: (rule: any, value: any, callback: any) => {
          const len = value.length
          if (len > 29 && len < 101) {
            callback()
          } else {
            callback(new Error("请输入影片中文简介(30-100字)"))
          }
        },
        trigger: ["blur", "change"]
      }
    ]
  },
  {
    label: "影片英文简介Film English Synopsis",
    val: "",
    field: "introduction_en",
    require: true,
    maxlength: 100,
    type: "input",
    width: "100%",
    inputType: "textarea",
    autosize: { minRows: 3, maxRows: 6 },
    rules: [
      { required: true, message: `请输入影片英文简介(30-100字)`, trigger: ["blur", "change"] },
      {
        validator: (rule: any, value: any, callback: any) => {
          const len = value.length
          if (len > 29 && len < 101) {
            callback()
          } else {
            callback(new Error("请输入影片英文简介(30-100字)"))
          }
        },
        trigger: ["blur", "change"]
      }
    ]
  },
  {
    label: "影片题材",
    val: "",
    field: "film_type",
    // require: true,
    type: "select",
    rightMargin: true,
    detailHeight: true,
    chooseList: [
      { label: "生物", value: "1" },
      { label: "天文", value: "2" },
      { label: "地理", value: "3" },
      { label: "科技", value: "4" },
      { label: "人文", value: "5" },
      { label: "自然", value: "6" },
      { label: "记录", value: "7" },
      { label: "航空", value: "8" },
      { label: "航天", value: "9" },
      { label: "艺术", value: "10" },
      { label: "历史", value: "11" },
      { label: "海洋", value: "12" },
      { label: "其他", value: "13" }
    ]
  },
  {
    label: "曾获奖项",
    val: "",
    field: "awards",
    // require: true,
    type: "input"
  },
  // {
  //     label: '公映许可证',
  //     val: '',
  //     field: 'screening_license',
  //     type: 'select',
  //     require: true,
  //     chooseList: [
  //         {
  //             label: '是',
  //             value: '1',
  //         },
  //         {
  //             label: '否',
  //             value: '2',
  //         },
  //     ],
  // },
  {
    label: "公映号",
    val: "",
    field: "screening_license_no",
    type: "input",
    rightMargin: true
    // require: true,
  },
  {
    label: "画面分辨率/Resolution",
    val: "",
    field: "resolution",
    type: "select",

    chooseList: [
      {
        label: "2K",
        value: "1"
      },
      {
        label: "4K",
        value: "2"
      },
      {
        label: "5K",
        value: "3"
      },
      {
        label: "其他",
        value: "4"
      }
    ]
  },
  {
    label: "帧速率/fps",
    val: "",
    field: "fps",
    type: "select",

    // rightMargin: true,
    chooseList: [
      {
        label: "24",
        value: "1"
      },
      {
        label: "25",
        value: "2"
      },
      {
        label: "30",
        value: "3"
      },
      {
        label: "其他",
        value: "4"
      }
    ]
  },
  {
    label: "声音格式/sound",
    val: "",
    field: "sound_track",
    type: "select",
    innerClass: true,
    chooseList: [
      {
        label: "立体声",
        value: "1"
      },
      {
        label: "5.1",
        value: "2"
      },
      {
        label: "7.1",
        value: "3"
      },
      {
        label: "全景声",
        value: "4"
      },
      {
        label: "其他",
        value: "5"
      }
    ]
  },

  {
    label: "影片海报",
    // val: 'https://inspur-scimall.cast.org.cn/2024/01/16/15/1705300931675.png',
    val: [],
    field: "film_poster",
    type: "upload",
    // rightMargin: true,
    require: true,
    uploadType: "img",
    title: "上传海报",
    accept: ".png, .jpg, .jpge, .webp, .gif",
    index: 0,
    detailHiddle: true
  },
  {
    label: "上传样片",
    val: [],
    field: "film_resource",
    type: "upload",
    uploadType: "video",
    title: "上传样片",
    require: true,
    accept: ".mpeg, .wmv, .RMVB, .WebM, .MP4, .mkv, .flv",
    index: 1,
    detailHiddle: true
  },
  // {
  //     label: '片花名称',
  //     val: '',
  //     field: 'trailer_name',
  //     type: 'input',
  //     require: true,
  //     rightMargin: true,
  //     detailHiddle: true
  // },
  {
    label: "上传片花",
    val: [],
    field: "trailer_url",
    type: "upload",
    uploadType: "video",
    title: "上传片花",
    require: true,
    accept: ".mpeg, .wmv, .RMVB, .WebM, .MP4, .mkv, .flv",
    index: 2,
    detailHiddle: true
  },

  // {
  //     label: '是否教育资源包',
  //     val: '',
  //     field: 'educational_materials',
  //     type: 'select',
  //     detailHeight: true,
  //     chooseList: [
  //         {
  //             label: '是',
  //             value: '1',
  //         },
  //         {
  //             label: '否',
  //             value: '2',
  //         },
  //     ],
  // },
  {
    label: "教育资源包/Educational Materials",
    val: "",
    field: "educational_materials_title",
    type: "input"
  },
  {
    label: "报送人姓名/Name of Applicant",
    val: "",
    field: "applicant_name",
    type: "input",
    require: true
  },
  {
    label: "报送人地址/Address of Applicant",
    val: "",
    field: "applicant_address",
    type: "input",
    require: true
  },
  {
    label: "报送人单位/Company of Applicant",
    val: "",
    field: "applicant_company",
    type: "input",
    require: true
  },
  {
    label: "联系方式手机号/telephone Number",
    val: "",
    field: "phone",
    type: "input",
    require: true,
    maxlength: 11,
    rules: [
      { required: true, message: `请输入联系方式（手机号）`, trigger: ["blur", "change"] },
      {
        validator: (rule: any, value: any, callback: any) => {
          const reg = /^1\d{10}$/
          if (reg.test(value)) {
            callback()
          } else {
            callback(new Error("请输入正确的联系方式（手机号）"))
          }
        },
        trigger: ["blur", "change"]
      }
    ]
  },
  {
    label: "邮箱/E-mail",
    val: "",
    field: "email",
    type: "input",
    require: true,
    rules: [
      { required: true, message: `请输入邮箱/E-mail`, trigger: ["blur", "change"] },
      {
        validator: (rule: any, value: any, callback: any) => {
          const reg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ //邮箱正则表达式
          if (reg.test(value)) {
            callback()
          } else {
            callback(new Error("请输入正确的邮箱/E-mail"))
          }
        },
        trigger: ["blur", "change"]
      }
    ]
  }
]

export function formateArr(item, info) {
  const { field } = item
  const val = info[field]
  if (item.chooseList && field !== "origin_area") {
    const arr = []
    console.log("val", val)
    item.chooseList.map((choose: any) => {
      if (val.includes(choose.value)) {
        arr.push(choose.label)
      }
    })
    return arr.join(",")
  } else {
    return val
  }
}
